package com.mervin.patterns.singleton.type8;

/***************************************
 * @Auther: mervin
 * @Date: 2020-04-16 00:07
 * @Description: 枚举类
 ***************************************/
public class SingletonEnum {
    public static void main(String[] args) {
        Singleton instance1 = Singleton.INSTANCE;
        Singleton instance2 = Singleton.INSTANCE;
        System.out.println(instance1 == instance2); // true
    }
}

enum Singleton{
    INSTANCE;

    public void fun(){
        System.out.println("调用方法fun（）");
    }
}
